// $Id$
package cz.pd.projectbuilder.main.gui.panel;

import cz.pd.projectbuilder.beans.load.ProjectBean;
import cz.pd.projectbuilder.main.listener.InfoListener;
import cz.pd.projectbuilder.main.listener.WorkingListener;
import cz.pd.projectbuilder.main.util.Info;
import cz.pd.projectbuilder.main.util.ListenersUtils;
import cz.pd.projectbuilder.main.util.ProjectUtils;
import javax.swing.JPanel;

/**
 *
 * @author diblik
 * @version $Revision$
 */
public class ButtonsPanel extends JPanel {

  private static final long serialVersionUID = 1L;

  /** Creates new form ButtonsFrame */
  public ButtonsPanel() {
    initComponents();
    ListenersUtils.addListener(new WorkingListener() {

      @Override
      public void startWorking() {
        throw new UnsupportedOperationException("Not supported yet.");
      }

      @Override
      public void stopWorking() {
        throw new UnsupportedOperationException("Not supported yet.");
      }
    });
  }

  /** This method is called from within the constructor to
   * initialize the form.
   * WARNING: Do NOT modify this code. The content of this method is
   * always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    panelTlacitkaDefined = new javax.swing.JPanel();
    buttonClear = new javax.swing.JButton();
    buttonDavka = new javax.swing.JButton();
    buttonSave = new javax.swing.JButton();
    buttonLoad = new javax.swing.JButton();
    checkBoxRunSuite = new javax.swing.JCheckBox();
    buttonClearAll = new javax.swing.JButton();
    jButton1 = new javax.swing.JButton();
    panelTlacitkaUser = new javax.swing.JPanel();
    panelAnimation = new javax.swing.JPanel();
    statusAnimationLabel = new javax.swing.JLabel();
    statusWaitLabel = new javax.swing.JLabel();

    setLayout(new java.awt.GridBagLayout());

    panelTlacitkaDefined.setLayout(new java.awt.GridBagLayout());

    javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance().getContext().getActionMap(ButtonsPanel.class, this);
    buttonClear.setAction(actionMap.get("clear")); // NOI18N
    java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("cz/pd/projectbuilder/main/gui/panel/Bundle"); // NOI18N
    buttonClear.setText(bundle.getString("ButtonsPanel.buttonClear.text")); // NOI18N
    buttonClear.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        buttonClearActionPerformed(evt);
      }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(2, 2, 0, 2);
    panelTlacitkaDefined.add(buttonClear, gridBagConstraints);

    buttonDavka.setAction(actionMap.get("davka")); // NOI18N
    buttonDavka.setText(bundle.getString("ButtonsPanel.buttonDavka.text")); // NOI18N
    buttonDavka.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        buttonDavkaActionPerformed(evt);
      }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(2, 2, 0, 2);
    panelTlacitkaDefined.add(buttonDavka, gridBagConstraints);

    buttonSave.setAction(actionMap.get("save")); // NOI18N
    buttonSave.setText(bundle.getString("ButtonsPanel.buttonSave.text")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(2, 2, 0, 2);
    panelTlacitkaDefined.add(buttonSave, gridBagConstraints);

    buttonLoad.setAction(actionMap.get("load")); // NOI18N
    buttonLoad.setText(bundle.getString("ButtonsPanel.buttonLoad.text")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 6;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
    panelTlacitkaDefined.add(buttonLoad, gridBagConstraints);

    checkBoxRunSuite.setAction(actionMap.get("suite")); // NOI18N
    checkBoxRunSuite.setText(bundle.getString("ButtonsPanel.checkBoxRunSuite.text")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(2, 2, 0, 2);
    panelTlacitkaDefined.add(checkBoxRunSuite, gridBagConstraints);

    buttonClearAll.setAction(actionMap.get("clearAll")); // NOI18N
    buttonClearAll.setText(bundle.getString("ButtonsPanel.buttonClearAll.text")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(2, 2, 0, 2);
    panelTlacitkaDefined.add(buttonClearAll, gridBagConstraints);

    jButton1.setAction(actionMap.get("runSuite")); // NOI18N
    jButton1.setText(bundle.getString("ButtonsPanel.jButton1.text")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(2, 2, 0, 2);
    panelTlacitkaDefined.add(jButton1, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.weightx = 1.0;
    add(panelTlacitkaDefined, gridBagConstraints);

    panelTlacitkaUser.setLayout(new javax.swing.BoxLayout(panelTlacitkaUser, javax.swing.BoxLayout.PAGE_AXIS));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.weighty = 1.0;
    add(panelTlacitkaUser, gridBagConstraints);

    panelAnimation.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(153, 153, 153)));
    panelAnimation.setLayout(new java.awt.GridBagLayout());

    statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
    panelAnimation.add(statusAnimationLabel, gridBagConstraints);

    statusWaitLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    statusWaitLabel.setMaximumSize(new java.awt.Dimension(35, 20));
    statusWaitLabel.setMinimumSize(new java.awt.Dimension(35, 20));
    statusWaitLabel.setPreferredSize(new java.awt.Dimension(35, 20));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    panelAnimation.add(statusWaitLabel, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
    gridBagConstraints.insets = new java.awt.Insets(1, 3, 3, 3);
    add(panelAnimation, gridBagConstraints);
  }// </editor-fold>//GEN-END:initComponents

    private void buttonClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonClearActionPerformed
      ListenersUtils.fire(InfoListener.class).clear();
    }//GEN-LAST:event_buttonClearActionPerformed

    private void buttonDavkaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDavkaActionPerformed
      for (ProjectBean projectBean : ProjectUtils.DAVKA.getDavky()) {
        Info.addInfo(projectBean.toString());
      }
    }//GEN-LAST:event_buttonDavkaActionPerformed
  // Variables declaration - do not modify//GEN-BEGIN:variables
  private javax.swing.JButton buttonClear;
  private javax.swing.JButton buttonClearAll;
  private javax.swing.JButton buttonDavka;
  private javax.swing.JButton buttonLoad;
  private javax.swing.JButton buttonSave;
  private javax.swing.JCheckBox checkBoxRunSuite;
  private javax.swing.JButton jButton1;
  private javax.swing.JPanel panelAnimation;
  private javax.swing.JPanel panelTlacitkaDefined;
  private javax.swing.JPanel panelTlacitkaUser;
  private javax.swing.JLabel statusAnimationLabel;
  private javax.swing.JLabel statusWaitLabel;
  // End of variables declaration//GEN-END:variables
}
